package de.baumann.browser.fragments.explore

import android.view.View
import de.baumann.browser.R
import de.baumann.browser.adapter.ExploreOdinDestroyRecordAdapter
import de.baumann.browser.adapter.ExploreOtherDestroyRecordAdapter
import de.baumann.browser.api.net.vo.explore.OtherDestroyBean
import de.baumann.browser.base.BaseOdinFragment
import de.baumann.browser.iview.explore.IOtherDestroyRecordView
import de.baumann.browser.present.explore.OtherDestroyPresenter
import kotlinx.android.synthetic.main.fragment_other_destroy_record.*

class OtherDestroyRecordFragment : BaseOdinFragment<IOtherDestroyRecordView, OtherDestroyPresenter>(), IOtherDestroyRecordView {


    companion object {
        val instance: OtherDestroyRecordFragment by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
            OtherDestroyRecordFragment()
        }
    }

    override fun getLayout(): Int {
        return R.layout.fragment_other_destroy_record
    }

    lateinit var exploreAdapters: ExploreOtherDestroyRecordAdapter
    override fun initView(view: View) {
        exploreAdapters = ExploreOtherDestroyRecordAdapter()
        reOtherRecord.adapter = exploreAdapters
    }

    override fun initData() {
    }

    override fun onResume() {
        super.onResume()
        getPresenter().getOtherDestroyList()
    }

    override fun createPresenter(): OtherDestroyPresenter? {
        return OtherDestroyPresenter()
    }

    override fun createView(): IOtherDestroyRecordView? {
        return this
    }

    override fun getDestroy(list: List<OtherDestroyBean>) {
        exploreAdapters.setNewData(list)
    }


}